-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while running sample script #1
Comments
Hey,
I haven't touched this code for a while, I'll take a look later tonight and
fix it.
Thanks,
Erik
…On Thu, Apr 23, 2020 at 1:14 PM Max ***@***.***> wrote:
Hi,
I wanted to run the sample. But I get the following error:
Traceback (most recent call last): File "ptttl/ptttl_audio_encoder.py",
line 87, in <module> ptttl_to_mp3(ptttl_data, sys.argv[2], 0.5,
tones.SINE_WAVE) File "ptttl/ptttl_audio_encoder.py", line 71, in
ptttl_to_mp3 ptttl_to_wav(ptttl_data, wavfile, amplitude, wavetype) File
"ptttl/ptttl_audio_encoder.py", line 67, in ptttl_to_wav samples =
_generate_wav_file(data, amplitude, wavetype, wav_filename) File
"ptttl/ptttl_audio_encoder.py", line 57, in _generate_wav_file
Mixer(SAMPLE_RATE, amplitude).mix(filename, samples) TypeError: mix() takes
1 positional argument but 3 were given
Then I tried to fix it by myself. I had the idea to replace this line:
Mixer(SAMPLE_RATE, amplitude).mix(filename, samples)
by
Mixer(SAMPLE_RATE, amplitude).write_wav(filename, samples)
But it also doesn't work. Any idea how to fix it? It tested the code on
Windows 10 and Linux.
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSPNR43S5AVRUUPL4PD4B3ROCOR3ANCNFSM4MPM47IA>
.
|
It should be fixed now. Note you will also need to download the newest
version of the 'tones' library (1.0.1), I just updated that too.
…On Thu, Apr 23, 2020 at 1:42 PM Erik Nyquist ***@***.***> wrote:
Hey,
I haven't touched this code for a while, I'll take a look later tonight
and fix it.
Thanks,
Erik
On Thu, Apr 23, 2020 at 1:14 PM Max ***@***.***> wrote:
> Hi,
> I wanted to run the sample. But I get the following error:
> Traceback (most recent call last): File "ptttl/ptttl_audio_encoder.py",
> line 87, in <module> ptttl_to_mp3(ptttl_data, sys.argv[2], 0.5,
> tones.SINE_WAVE) File "ptttl/ptttl_audio_encoder.py", line 71, in
> ptttl_to_mp3 ptttl_to_wav(ptttl_data, wavfile, amplitude, wavetype) File
> "ptttl/ptttl_audio_encoder.py", line 67, in ptttl_to_wav samples =
> _generate_wav_file(data, amplitude, wavetype, wav_filename) File
> "ptttl/ptttl_audio_encoder.py", line 57, in _generate_wav_file
> Mixer(SAMPLE_RATE, amplitude).mix(filename, samples) TypeError: mix() takes
> 1 positional argument but 3 were given
>
> Then I tried to fix it by myself. I had the idea to replace this line:
> Mixer(SAMPLE_RATE, amplitude).mix(filename, samples)
> by
> Mixer(SAMPLE_RATE, amplitude).write_wav(filename, samples)
>
> But it also doesn't work. Any idea how to fix it? It tested the code on
> Windows 10 and Linux.
> Thanks!
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABSPNR43S5AVRUUPL4PD4B3ROCOR3ANCNFSM4MPM47IA>
> .
>
|
Hi Erik,
|
OK, glad you got it working. 1.0.1 is up on pypi
https://pypi.org/project/tones/
and that code you said you added is actually already in there
https://github.com/eriknyquist/tones/blob/master/tones/mixer.py#L401
not sure what went wrong.
…On Tue, Apr 28, 2020 at 11:05 AM Max ***@***.***> wrote:
Hi Erik,
thanks for the quick fix. I got it running. However, it fixed some lines
of code in tones. I assume you forgot to push 1.0.1.
This are my new code in mixer.py
` def write_wav(self, filename, sampledata=None):
"""
Mixes all tracks into a single stream of samples and writes to a
.wav audio file
:param str filename: name of file to write
"""
f = wave.open(filename, 'w')
if sampledata is None:
sampledata = self.mix().serialize()
f.setparams((tones.NUM_CHANNELS, tones.DATA_SIZE, self._rate,
int(len(sampledata) / 2), "NONE", "Uncompressed"))
f.writeframes(sampledata)
f.close()`
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSPNR7ZOD26TSD7GWOVGXTRO4LE3ANCNFSM4MPM47IA>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I wanted to run the sample. But I get the following error:
Traceback (most recent call last): File "ptttl/ptttl_audio_encoder.py", line 87, in <module> ptttl_to_mp3(ptttl_data, sys.argv[2], 0.5, tones.SINE_WAVE) File "ptttl/ptttl_audio_encoder.py", line 71, in ptttl_to_mp3 ptttl_to_wav(ptttl_data, wavfile, amplitude, wavetype) File "ptttl/ptttl_audio_encoder.py", line 67, in ptttl_to_wav samples = _generate_wav_file(data, amplitude, wavetype, wav_filename) File "ptttl/ptttl_audio_encoder.py", line 57, in _generate_wav_file Mixer(SAMPLE_RATE, amplitude).mix(filename, samples) TypeError: mix() takes 1 positional argument but 3 were given
Then I tried to fix it by myself. I had the idea to replace this line:
Mixer(SAMPLE_RATE, amplitude).mix(filename, samples)
by
Mixer(SAMPLE_RATE, amplitude).write_wav(filename, samples)
But it also doesn't work. Any idea how to fix it? It tested the code on Windows 10 and Linux.
Thanks!
The text was updated successfully, but these errors were encountered: