Skip to content
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

Sounds are mellow #1

Closed
liudr opened this issue Oct 8, 2020 · 4 comments
Closed

Sounds are mellow #1

liudr opened this issue Oct 8, 2020 · 4 comments
Assignees
Labels
investigation More investigation needed to determine whether this is a bug

Comments

@liudr
Copy link

liudr commented Oct 8, 2020

Hi,

Great python module you made! I'm trying to learn piano cords so I'm just using python and your module to generate the sounds of cords, such as c major cord, by c-e-g in that order and then using 3 channels one for each ceg simultaneously so I can hear the cord. I chose SINE_WAVE but the sound is very mellow, not like the hard sine wave sound. Here is my script. Could you take a look? Thanks.

`from tones import SINE_WAVE, SAWTOOTH_WAVE
from tones.mixer import Mixer

mixer = Mixer(44100, 1)

mixer.create_track(0, SINE_WAVE, attack=0.1, decay=0.1)
mixer.create_track(1, SINE_WAVE, attack=0.1, decay=0.1)
mixer.create_track(2, SINE_WAVE, attack=0.1, decay=0.1)

mixer.add_note(0, note='c', octave=4, duration=1.0)
mixer.add_note(0, note='e', octave=4, duration=1.0)
mixer.add_note(0, note='g', octave=4, duration=1.0)
mixer.add_note(0, note='c', octave=4, duration=3.0)

mixer.add_note(1, note='c', octave=4, duration=1.0)
mixer.add_note(1, note='e', octave=4, duration=1.0)
mixer.add_note(1, note='g', octave=4, duration=1.0)
mixer.add_note(1, note='e', octave=4, duration=3.0)

mixer.add_note(2, note='c', octave=4, duration=1.0)
mixer.add_note(2, note='e', octave=4, duration=1.0)
mixer.add_note(2, note='g', octave=4, duration=1.0)
mixer.add_note(2, note='g', octave=4, duration=3.0)

mixer.write_wav('tones.wav')

samples = mixer.mix()
`

@thehale
Copy link
Contributor

thehale commented Nov 24, 2020

Just wanting to add some additional observations related to this issue...

If you download the app Spectroid on Android (https://play.google.com/store/apps/details?id=org.intoorbit.spectrum) you can see the exact frequencies that this module puts out. I've noticed that the "pure" sine wave often has several harmonics that come through as well. Those harmonics are likely what's making the tone more "mellow". For example, in the attached image, the bright pink bits on the left are the actual frequencies I mixed together, while the faint blips to the right are harmonic frequencies that came through as well.
1kHz Base - Silent

Those harmonics may be the result of this module (I'm still looking through the implementation to see if that seems to be the case), but I'd suspect your computer's sound card has something to do with it as well. I'm under the impression that many such cards do slight modifications to the sounds they are given to play so that they will "sound better".

@eriknyquist
Copy link
Owner

eriknyquist commented Nov 24, 2020 via email

@eriknyquist
Copy link
Owner

eriknyquist commented Nov 29, 2020

@liudr FYI, @jhale1805 has graciously fixed a bug that was causing imperfect sine waves to be generated. He has made a pull request here #4, which we are still working on, but when that pull request is merged then this may fix the original problem you reported for sine waves not sounding quite right. I will release a new version on pip when those changes are all ironed out.

@eriknyquist
Copy link
Owner

tones 1.2.0 can be installed with "pip" now, all waveforms should be sounding correct now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigation More investigation needed to determine whether this is a bug
Projects
None yet
Development

No branches or pull requests

3 participants