kopia lustrzana https://github.com/backface/turtlestitch
added sampling rate input to "new sound" primitive
rodzic
6306bcc279
commit
371769ae40
|
@ -15,6 +15,7 @@
|
|||
|
||||
### 2019-10-20
|
||||
* objects, threads: added "new sound" from list of samples primitive reporter to "sound" category
|
||||
* objects, threads: added sampling rate input to "new sound" primitive
|
||||
|
||||
### 2019-10-18
|
||||
* objects, blocks, threads: added dimension getters for the stage
|
||||
|
|
|
@ -481,7 +481,8 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
reportNewSoundFromSamples: {
|
||||
type: 'reporter',
|
||||
category: 'sound',
|
||||
spec: 'new sound %l'
|
||||
spec: 'new sound %l at %rate Hz',
|
||||
defaults: [null, 44100]
|
||||
},
|
||||
doRest: {
|
||||
type: 'command',
|
||||
|
|
|
@ -2818,7 +2818,7 @@ Process.prototype.encodeSound = function (samples, rate) {
|
|||
|
||||
// Process first-class sound creation from samples, interpolated
|
||||
|
||||
Process.prototype.reportNewSoundFromSamples = function (samples) {
|
||||
Process.prototype.reportNewSoundFromSamples = function (samples, rate) {
|
||||
// interpolated
|
||||
var audio, blob, reader,
|
||||
myself = this;
|
||||
|
@ -2829,7 +2829,7 @@ Process.prototype.reportNewSoundFromSamples = function (samples) {
|
|||
};
|
||||
audio = new Audio();
|
||||
blob = this.audioBufferToWaveBlob(
|
||||
this.encodeSound(samples, 44100).audioBuffer,
|
||||
this.encodeSound(samples, rate || 44100).audioBuffer,
|
||||
samples.length()
|
||||
);
|
||||
reader = new FileReader();
|
||||
|
|
Ładowanie…
Reference in New Issue