-
Notifications
You must be signed in to change notification settings - Fork 10
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
[DO NOT MERGE] Sim changes for forthcoming beta MicroPython release #113
Draft
microbit-matt-hillsdon
wants to merge
36
commits into
main
Choose a base branch
from
beta-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 18 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
699a2d7
Work towards building on the audio-recording branch
microbit-matt-hillsdon 202c7fd
The simulator compiles (with my local mpy change)
microbit-matt-hillsdon 41ff6b0
Add pin touches sample
microbit-grace 292addc
Update pin_touches sample to include logo
microbit-grace b73637d
WIP record audio
microbit-grace 1b9465a
Initial steps towards microphone HAL
microbit-matt-hillsdon 9cc4b2b
Microphone: get as far as reading samples
microbit-matt-hillsdon c971228
WIP convertToUnit8Array
microbit-grace 3c4a79c
Update to latest from audio-recording branch
microbit-matt-hillsdon 7aaa800
Remove unused HAL method
microbit-matt-hillsdon c562955
Reinstate clear on display for non-HAL use (reset)
microbit-matt-hillsdon 88e2baf
Safari 13 compatible speech option
microbit-matt-hillsdon 41e7ce3
Merge branch 'beta-updates' of https://github.com/microbit-foundation…
microbit-grace 2916e18
WIP
microbit-matt-hillsdon 62a338e
WIP playing recorded audio
microbit-matt-hillsdon 8eb6fa7
Update
microbit-matt-hillsdon 26a4ee4
Roughly works
microbit-matt-hillsdon 2cda4d2
Sample program
microbit-matt-hillsdon d232569
Fix set rate in record.py
microbit-grace 19b095b
Remove debug
microbit-matt-hillsdon 90292b6
Merge branch 'beta-updates' of https://github.com/microbit-foundation…
microbit-grace 3c30c59
Give older Safari a chance
microbit-matt-hillsdon 4f1baa3
Tweak Safari workaround
microbit-matt-hillsdon ef44717
Fix PR feedback
microbit-matt-hillsdon 5907c05
Tweak sample to allow on-the-fly rate change
microbit-matt-hillsdon 4ed8c93
Remove browser tab mic indicator
microbit-grace aea7937
Activate sim mic light when recording
microbit-grace 8798367
Update simulator micropython lib
microbit-grace 4da3f33
Add microphone.set_sensitivity example and js hal
microbit-grace 6042086
Update to latest
microbit-matt-hillsdon 06b4549
Tweak AUDIO_OUTPUT_BUFFER_SIZE and document
microbit-matt-hillsdon b887f22
Audio fixes
microbit-matt-hillsdon 34e45b3
Update MicroPython to fix silent frames issue
microbit-matt-hillsdon 7d84c58
Update MicroPython
microbit-matt-hillsdon 677585f
Update MicroPython
microbit-matt-hillsdon ab07528
Resample via a libsamplerate (#117)
microbit-matt-hillsdon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule micropython-microbit-v2
updated
52 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from microbit import * | ||
|
||
def report_pin_touches(pin, pin_type): | ||
if pin.was_touched(): | ||
print('pin', pin_type, 'was touched', pin.get_touches(), 'time(s)') | ||
|
||
while True: | ||
if button_a.is_pressed(): | ||
report_pin_touches(pin0, "0") | ||
report_pin_touches(pin1, "1") | ||
report_pin_touches(pin2, "2") | ||
report_pin_touches(pin_logo, "logo") | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from microbit import microphone, audio, button_a, button_b | ||
|
||
rates = [7812, 3906, 15624] | ||
rate_index = 0 | ||
|
||
print("Recording...") | ||
frame = microphone.record(3000) | ||
print("Button A to play") | ||
while True: | ||
if button_a.was_pressed(): | ||
audio.play(frame) | ||
if button_b.was_pressed(): | ||
rate_index = (rate_index + 1) % len(rates); | ||
frame.rate = rates[rate_index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScriptProcessorNode support vs AudioWorklet support so we'd lose early Safari 14.x and Safari 13 (for 13 I think limited support is OK).
See also the techniques used in this project.