-
Notifications
You must be signed in to change notification settings - Fork 27
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
music.pitch characteristics have changed; high pitches have background clicks #67
Comments
The older version uses direct PWM for music output. The newer version uses the CODAL mixer and virtual pin. So the difference in sound is most likely due to the CODAL mixer. Can you provide a simpler example of a sound effect that has changed? Running the mimic example attached above, it's hard to reproduce things consistently. Maybe write some simple code that does the fast pitch change sound effect? Then we can compare that on "old" and "new" and maybe rewrite in C++ to see if it really is a CODAL issue. |
The sonic() function was one I wrote many years ago for the Doctor Who Mission Sonic programme. Here is the original code, I suggest this is a good basis for sound comparisons, as the original code sounded exactly like a sonic screwdriver, using frequency modulation. (Actually a real sonic screwdriver uses both FM and AM, but it sounded close enough by just doing the FM part).
|
@martinwork @dpgeorge is David's example good to debug? Or do we need a smaller one to do a C++ version to check in CODAL? |
@microbit-carlos Here is a C++ sample that confirms, as @dpgeorge said, the difference is in using virtualOutputPin. Press B for uBit.io.speaker After trying both it's necessary to reset to try again.
|
@microbit-carlos where shall we go from here, is it important to make the |
The following works, but not music.pitch() in the same program, which is the same problem I had in C++.
|
Thanks @martinwork, we should take this to CODAL to be investigated over there. Could you open an issue in the codal-microbit-v2 repo and summarise all the finding listed here? |
@microbit-carlos We already have lancaster-university/codal-microbit-v2#42, that I started looking at yesterday. |
Is the fix from lancaster-university/codal-microbit-v2@6e880bc now applied here? |
The latest tag, v0.2.33, was released in July and that commit was added in August, so it's not in a CODAL release yet. |
Yes it is now applied in this repo, CODAL was updated to v0.2.35 in 76c1b31 |
@martinwork could you please test with the version of MicroPython in https://python.microbit.org/v/beta and close this if the issue is now resolved? |
There are two hexes in the original mimic.zip. The older one doesn't load into Python v2 or beta. This is not a new problem, but maybe worth noting that the error messages are different. I loaded and saved the newer one in beta and made a new zip: mimic03Aug22.zip The behaviour of the program and the microphone sensitivity seems different, compared to the original hex. The sound is OK, though very slightly different, I think. |
Micro:bit Foundation support ticket - 43597
Thanks @whaleygeek !
mimic.zip
The zip contains two versions of a hex that produces sounds on the speaker to mimic patterns recorded at the microphone. The newer script has been updated for the new microphone event APIs but is the same for sound output via music.pitch. The old one was built with "MicroPython 93e48c3 on 2020-09-08". I have just resaved the new one with Editor Version: 2.2.0-beta.4.
I noticed 2 changes: jumps between pitches and poor quality sound for higher pitches.
The original has a great sound effect which is lost in the new version. At first, it seemed like maybe the new one was doing a better job of producing the sounds, making it sound more musical. But, with longer durations, it's clear the old one sounds like a single tone which changes pitch, whereas the new one has distinct "twiddly" changes. It's as if the old one is merging from pitch to pitch, while the new one is restarting for each change.
Then I tried using the REPL of each version to play simple tones (e.g. import music; music.pitch(3000)). And 2000, 1000, 440... The 440 notes are noticeably different, though I couldn't say which is correct. The old version has a purer tone for the high frequencies, with the new one having a background clicking.
The text was updated successfully, but these errors were encountered: