Commit graph

215 commits

Author SHA1 Message Date
Michael "Z" Goddard
618239654f
fixup! extend existing effects from Effect 2018-06-05 14:42:46 -04:00
Michael "Z" Goddard
5b8f0fce65
fixup! extend existing effects from Effect 2018-06-05 13:59:53 -04:00
Michael "Z" Goddard
61e54b2457
extend existing effects from Effect
Add Effect class that manages connecting the effects in a chain from
their AudioPlayer to the AudioEngine.
2018-06-05 12:46:29 -04:00
Michael "Z" Goddard
d5b6290d45
break up index.js into files per class
- Add AudioEngine.js
- Add AudioPlayer.js
- Add Loudness.js
2018-06-04 18:11:44 -04:00
Karishma Chadha
8d67c6a4c3 Update variable name. 2018-04-17 09:36:21 -04:00
Karishma Chadha
a3ecd2ddc2 More refactoring/code-cleanup addressing PR comments. 2018-04-13 17:46:09 -04:00
Karishma Chadha
158adb0868 refactor decodeSound function, to only use sound data buffer to decode the sound instead of relying metadata from the project json 2018-04-13 11:40:34 -04:00
Eric Rosenbaum
84fdf5c76a
Merge pull request #70 from towerofnix/fix-firefox-loudness
Don't use mediaStream property, which is missing on Firefox
2018-01-16 15:39:58 -05:00
Eric Rosenbaum
d2b6cb40e3 Disconnect audio nodes on dispose 2018-01-09 18:18:49 -05:00
Florrie
3318b14457
Don't use mediaStream property
..which is missing on Firefox. Fixes #67.
2018-01-04 08:31:09 -04:00
Eric Rosenbaum
734f976585 New name and value for DECAY_TIME 2017-12-20 15:17:26 -05:00
Eric Rosenbaum
1c8a545a8a Set gain using setTargetAtTime 2017-12-20 12:07:53 -05:00
Paul Kaplan
dce5316551 Remove leftover references to adrum and note player 2017-11-22 09:55:02 -05:00
Eric Rosenbaum
b15312702e Remove log 2017-11-21 10:50:59 -05:00
Eric Rosenbaum
730c57a976 Remove instruments and drums 2017-11-21 10:44:50 -05:00
Eric Rosenbaum
202d6d8b02 Add a function to get an AudioPlayer’s input node 2017-11-09 16:28:03 -05:00
Eric Rosenbaum
283049e514 Safely stop sounds in safari 2017-08-22 11:33:18 -04:00
Paul Kaplan
a9168f04aa Use StartAudioContext to allow playing on mobile safari 2017-07-26 20:20:39 -04:00
Paul Kaplan
20d05ee5c9 Merge pull request #57 from paulkaplan/use-uid-not-md5
Play sounds by unique sound ID and allow getting/setting buffers by sound ID
2017-07-26 08:59:43 -04:00
Paul Kaplan
e8334e5a9b Fix getter 2017-07-25 12:55:23 -04:00
Paul Kaplan
062f39244b Add public getter/setter for buffers 2017-07-25 12:30:30 -04:00
Eric Rosenbaum
f26dbde03b Merge pull request #56 from LLK/feature/decodeaudiodata-safari
Fall back to the older callback API for decodeAudioData
2017-07-25 11:35:09 -04:00
Eric Rosenbaum
5cb4146aa7 Merge pull request #55 from LLK/feature/panner
Implement panning without panner node
2017-07-25 11:34:51 -04:00
Paul Kaplan
0555407406 Use uid instead of md5 for keying audio buffer cache 2017-07-25 11:33:56 -04:00
Eric Rosenbaum
aa2adf6c03 Fall back to the older callback API for decodeAudioData
If promises are not supported, such as on Safari
2017-07-21 12:35:21 -04:00
Eric Rosenbaum
68d5ac2e34 Lint 2017-07-21 12:10:32 -04:00
Eric Rosenbaum
89cdb92c23 Implement panning without panner node 2017-07-21 12:04:43 -04:00
Eric Rosenbaum
643d33e482 Use audio-context module for shared audiocontext
To prevent creating multiple audio contexts
2017-07-21 10:50:15 -04:00
Eric Rosenbaum
dd0d9556ed Explain loudness scaling, and clamp to 100 2017-06-23 13:13:30 -04:00
Eric Rosenbaum
5add85bd60 Fix comments 2017-06-23 11:58:04 -04:00
Eric Rosenbaum
dba8c6f91d Adjust loudness smoothing 2017-06-23 10:59:10 -04:00
Eric Rosenbaum
a081333ddd Fix comment 2017-06-22 11:07:24 -04:00
Eric Rosenbaum
b7ff586ca1 Inline the interval to frequency function 2017-06-22 11:06:12 -04:00
Eric Rosenbaum
66b4ae3795 Remove unused variable 2017-06-22 10:54:52 -04:00
Eric Rosenbaum
0bc892f03d Use “audioContext” to refer to webAudioContext 2017-06-22 10:51:57 -04:00
Eric Rosenbaum
90af375b03 Use arrow functions 2017-06-21 11:23:32 -04:00
Eric Rosenbaum
43e0408434 Lint 2017-06-21 10:46:42 -04:00
Eric Rosenbaum
2974a5e65b Re-implement loudness block 2017-06-20 18:34:12 -04:00
Eric Rosenbaum
03034dd2f7 Remove dependency on Tone.js 2017-06-20 16:50:02 -04:00
Eric Rosenbaum
865d3cde88 Correctly call this.intervalToFrequencyRatio 2017-06-19 17:41:08 -04:00
Eric Rosenbaum
e515bf4026 Cleanup 2017-06-19 17:40:53 -04:00
Eric Rosenbaum
5e6e33264d Remove tone.js dependency 2017-06-19 17:25:11 -04:00
Eric Rosenbaum
ff6cd4a094 Remove all audio effects except pitch and pan 2017-06-19 14:33:23 -04:00
Paul Kaplan
5c4a88b739 Make a copy before using audio buffer 2017-06-14 09:10:35 -04:00
Eric Rosenbaum
e8864387c6 Use native audio buffer source node
Instead of the Tone js wrapper for it, because a recent update to Tone changed the ‘onended’ callback in a way that broke our “play sound until done” block.
2017-04-18 18:40:06 -04:00
Ray Schamp
ea3c4a47f2 Fix while condition, disable eslint complaint 2017-04-18 18:05:36 -04:00
Ray Schamp
fa879cee9d Fix static getters
Thanks @ericrosenbaum!
2017-04-18 17:59:37 -04:00
Ray Schamp
9874cf006f Update to use ES6 class syntax 2017-04-18 12:22:06 -04:00
Ray Schamp
e50ba400f9 Update syntax for eslint-config-scratch 2017-04-17 11:52:12 -04:00
Ray Schamp
ee8462f53f Pass with eslint --fix 2017-04-17 11:52:12 -04:00
Ray Schamp
cd699dbc0f Install and configure eslint-config-scratch 2017-04-17 11:52:12 -04:00
Ray Schamp
0610f8a6ce Update packages, fix lint error 2017-04-17 11:11:06 -04:00
Eric Rosenbaum
c354189385 Merge pull request #33 from LLK/feature/loudness
Add mic input for loudness block
2017-04-07 14:02:22 -04:00
Paul Kaplan
6128309d93 Add jsdoc for decodeSound function 2017-03-31 12:09:07 -04:00
Paul Kaplan
cc454f2f72 Return the loader promise for chaining 2017-03-31 12:02:36 -04:00
Eric Rosenbaum
04467673b3 Add stub for loadSounds function with warning
… so that the gui can call it without breaking, until it is updated.
2017-03-31 10:50:21 -04:00
Eric Rosenbaum
b14852ab3c If mic is not enabled, return -1
To match Scratch 2.0 behavior
2017-03-27 13:23:01 -04:00
Eric Rosenbaum
83afeb1916 Tidy up sound decoding 2017-03-27 11:51:01 -04:00
Eric Rosenbaum
3608a5947f Decode sounds in audio engine
Remove logic for loading sounds, since that is handled by Scratch Storage
2017-03-22 18:09:42 -04:00
Eric Rosenbaum
c5daccef7c Rename to ADPCMSoundDecoder, and only decode
Scratch Storage now handles asset loading, so this class is now just the decoder
2017-03-22 18:08:44 -04:00
Eric Rosenbaum
7d6adf5864 Add mic input for loudness block 2017-03-20 18:49:37 -04:00
Eric Rosenbaum
ce9766451f Update jsdocs 2017-02-09 15:48:37 -05:00
Eric Rosenbaum
b91226f9e8 playnote uses volume from vm to set gain 2017-02-09 14:53:59 -05:00
Eric Rosenbaum
5e0e4e2e82 added a comma to a comment 2017-02-02 15:52:36 -05:00
Eric Rosenbaum
bea203e122 fix JSDoc comment 2017-02-02 15:48:26 -05:00
Eric Rosenbaum
7e671791b8 use an enum for audio effect names 2017-02-02 15:41:16 -05:00
Eric Rosenbaum
de99228cd8 check for own property in for (var _ in _ ) 2017-02-02 15:25:36 -05:00
Eric Rosenbaum
1c4709e5b9 bind to set isPlaying flag on ended 2017-02-02 15:25:26 -05:00
Eric Rosenbaum
b68c84af02 check for own property in for (var _ in _ ) 2017-02-02 15:10:10 -05:00
Eric Rosenbaum
1a26fecca1 Comment all the things! 2017-02-02 14:53:17 -05:00
Eric Rosenbaum
cdc49def15 create empty object for use as a map 2017-02-02 14:51:02 -05:00
Eric Rosenbaum
a1baa94d3c initialization 2017-02-02 14:49:17 -05:00
Eric Rosenbaum
7483cbdb2f JSDoc comments 2017-02-01 18:02:04 -05:00
Eric Rosenbaum
dcdc2c0831 check for non-existent sound 2017-01-31 18:36:29 -05:00
Eric Rosenbaum
08a81af9e5 volume state handled in vm sound blocks 2017-01-31 18:35:37 -05:00
Eric Rosenbaum
b70607d659 comments 2017-01-31 18:35:06 -05:00
Eric Rosenbaum
c564ca5b90 remove unused function 2017-01-31 18:34:56 -05:00
Eric Rosenbaum
088efdeb0e sounds track playing state 2017-01-30 18:13:18 -05:00
Eric Rosenbaum
7f741a509c sounds stop and restart when played again 2017-01-30 18:12:52 -05:00
Eric Rosenbaum
0742e8e0b0 update comments 2017-01-30 11:27:05 -05:00
Eric Rosenbaum
bee8210764 use promise on playback finished 2017-01-30 11:26:55 -05:00
Eric Rosenbaum
002a378d97 soundplayers are explicitly connected to output node when created 2017-01-30 11:25:43 -05:00
Eric Rosenbaum
42f231858a effects are managed by vm target and audio engine 2017-01-30 11:24:55 -05:00
Eric Rosenbaum
263f614ef8 pitch effect is applied to active sound players array 2017-01-30 11:18:28 -05:00
Eric Rosenbaum
c9029396c6 state of effects, volume and instrument managed by target in vm 2017-01-30 11:17:18 -05:00
Eric Rosenbaum
7b07d150da set instrument moved to target in vm 2017-01-30 11:14:07 -05:00
Eric Rosenbaum
8557c4a7ab audio engine manages play note and beat timing 2017-01-30 11:13:34 -05:00
Eric Rosenbaum
e1d478244d audioengine loads sounds indexed by md5
audioplayers store list of their own active sound players indexed by md5 of the sound. sound players are created when the sound is played, deleted when it ends, and removed from the list of active sound players. the pitch effect uses this list of active sound players to set their playback ratios.
2017-01-30 11:09:45 -05:00
Eric Rosenbaum
a150f018b5 comments 2017-01-30 10:59:03 -05:00
Eric Rosenbaum
b32ee9267b properties for number of instruments and drums for use by vm 2017-01-11 11:40:35 -05:00
Eric Rosenbaum
3c520d6e10 converesion from one-indexing to zero-indexing happens in vm 2017-01-11 11:26:03 -05:00
Eric Rosenbaum
ad81e1d3de load and play drum sounds from drumplayer 2017-01-10 18:05:29 -05:00
Eric Rosenbaum
ca8bc2b45d move global tempo setting to audio engine 2017-01-10 18:04:54 -05:00
Eric Rosenbaum
b540c8ec7b remove commented code 2017-01-10 18:04:13 -05:00
Eric Rosenbaum
e2255bbbbf comments 2017-01-10 18:04:01 -05:00
Eric Rosenbaum
c54fc0f154 comments 2017-01-10 18:03:15 -05:00
Eric Rosenbaum
703502cfbb add stopall function for instruments and drums 2017-01-10 18:02:45 -05:00
Eric Rosenbaum
193a9f181b initial experiment with drumplayer ( 2017-01-10 11:35:03 -05:00
Eric Rosenbaum
0a55312899 change function name to playNoteForSecWithInst 2017-01-10 11:01:36 -05:00
Eric Rosenbaum
a1c31c3f4b send duration in sec to instrumentplayer 2017-01-10 11:00:22 -05:00