diff --git a/HISTORY.md b/HISTORY.md
index d265ec15..cd91a71a 100755
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -56,6 +56,7 @@
* added microphone "resolution" concept governing "bins" (buffer / bin sizes)
* added microphone "resolution" settings to GUI
* updated German translation for microphone settings
+* removed microphone resolution setters from audioComp library
### 2019-03-10
* Objects, Blocks, Threads: added microphone note and pitch detection
diff --git a/libraries/audioComp_module.xml b/libraries/audioComp_module.xml
index dcf0b039..86c90f6b 100644
--- a/libraries/audioComp_module.xml
+++ b/libraries/audioComp_module.xml
@@ -1 +1 @@
-durationname
duration
length
number of channels
sample rate
samplessamplessoundvar base64, binaryString, len, bytes, i,
arrayBuffer, audioCtx;
if (sound.audioBuffer) {
return;
}
base64 = sound.audio.src.split(',')[1];
binaryString = window.atob(base64);
len = binaryString.length;
bytes = new Uint8Array(len);
for (i = 0; i < len; i += 1) {
bytes[i] = binaryString.charCodeAt(i);
}
arrayBuffer = bytes.buffer;
Note.prototype.setupContext();
audioCtx = Note.prototype.audioContext;
audioCtx.decodeAudioData(arrayBuffer, function(buffer) {
sound.audioBuffer = buffer;
});soundreturn !isNil(sound.audioBuffer);soundchoiceswitch (choice) {
case 'sample rate':
return sound.audioBuffer.sampleRate;
case 'duration':
return sound.audioBuffer.duration;
case 'length':
return sound.audioBuffer.length;
case 'number of channels':
return sound.audioBuffer.numberOfChannels;
default:
return sound.audioBuffer;
}play back a sound, a list of samples (single channel), or a list of lists (multiple channels) at the given sample rate.
for demo purposes this block also fast-plots the samples on the stage4410022.05 kHz=22050
44.1 kHz=44100
88.2 kHz=88200
96 kHz=96000samplesratevar audioCtx, channels, frameCount, arrayBuffer, i, source;
Note.prototype.setupContext();
audioCtx = Note.prototype.audioContext;
channels = (samples.at(1) instanceof List) ? samples.length() : 1;
frameCount = (channels === 1) ? samples.length() : samples.at(1).length();
arrayBuffer = audioCtx.createBuffer(channels, frameCount, rate);
if (!arrayBuffer.copyToChannel) {
arrayBuffer.copyToChannel = function (src, channel) {
var buffer = this.getChannelData(channel);
for (i = 0; i < src.length; i += 1) {
buffer[i] = src[i];
}
}
}
if (channels === 1) {
arrayBuffer.copyToChannel(Float32Array.from(samples.asArray()), 0, 0);
} else {
for (i = 0; i < channels; i += 1) {
arrayBuffer.copyToChannel(Float32Array.from(samples.at(i + 1).asArray()), i, 0);
}
}
source = audioCtx.createBufferSource();
source.buffer = arrayBuffer;
source.connect(audioCtx.destination);
source.start();
source.pause = source.stop;
this.parentThatIsA(StageMorph).activeSounds.push(source);generate a list of samples representing a sine wave at the given frequency, duration and sample rate440a 55=55
a 110=110
a 220=220
a 440=440
a 880=880
a 1760=1760
a 3520=352014410022.05 kHz=22050
44.1 kHz=44100
88.2 kHz=88200
96 kHz=960000.51quickly plot the samples of a sound, a list of samples (single channel), or a list of lists (multiple channels) to the stage at a lower resolution.1offset-2records an audio snippet and reports it as a new sound, or zero if the user cancelsbufferbuffer
fft512256
512
1024
2048
4096
8192
163844406969
\ No newline at end of file
+durationname
duration
length
number of channels
sample rate
samplessamplessoundvar base64, binaryString, len, bytes, i,
arrayBuffer, audioCtx;
if (sound.audioBuffer) {
return;
}
base64 = sound.audio.src.split(',')[1];
binaryString = window.atob(base64);
len = binaryString.length;
bytes = new Uint8Array(len);
for (i = 0; i < len; i += 1) {
bytes[i] = binaryString.charCodeAt(i);
}
arrayBuffer = bytes.buffer;
Note.prototype.setupContext();
audioCtx = Note.prototype.audioContext;
audioCtx.decodeAudioData(arrayBuffer, function(buffer) {
sound.audioBuffer = buffer;
});soundreturn !isNil(sound.audioBuffer);soundchoiceswitch (choice) {
case 'sample rate':
return sound.audioBuffer.sampleRate;
case 'duration':
return sound.audioBuffer.duration;
case 'length':
return sound.audioBuffer.length;
case 'number of channels':
return sound.audioBuffer.numberOfChannels;
default:
return sound.audioBuffer;
}play back a sound, a list of samples (single channel), or a list of lists (multiple channels) at the given sample rate.
for demo purposes this block also fast-plots the samples on the stage4410022.05 kHz=22050
44.1 kHz=44100
88.2 kHz=88200
96 kHz=96000samplesratevar audioCtx, channels, frameCount, arrayBuffer, i, source;
Note.prototype.setupContext();
audioCtx = Note.prototype.audioContext;
channels = (samples.at(1) instanceof List) ? samples.length() : 1;
frameCount = (channels === 1) ? samples.length() : samples.at(1).length();
arrayBuffer = audioCtx.createBuffer(channels, frameCount, rate);
if (!arrayBuffer.copyToChannel) {
arrayBuffer.copyToChannel = function (src, channel) {
var buffer = this.getChannelData(channel);
for (i = 0; i < src.length; i += 1) {
buffer[i] = src[i];
}
}
}
if (channels === 1) {
arrayBuffer.copyToChannel(Float32Array.from(samples.asArray()), 0, 0);
} else {
for (i = 0; i < channels; i += 1) {
arrayBuffer.copyToChannel(Float32Array.from(samples.at(i + 1).asArray()), i, 0);
}
}
source = audioCtx.createBufferSource();
source.buffer = arrayBuffer;
source.connect(audioCtx.destination);
source.start();
source.pause = source.stop;
this.parentThatIsA(StageMorph).activeSounds.push(source);generate a list of samples representing a sine wave at the given frequency, duration and sample rate440a 55=55
a 110=110
a 220=220
a 440=440
a 880=880
a 1760=1760
a 3520=352014410022.05 kHz=22050
44.1 kHz=44100
88.2 kHz=88200
96 kHz=960000.51quickly plot the samples of a sound, a list of samples (single channel), or a list of lists (multiple channels) to the stage at a lower resolution.1offset-2records an audio snippet and reports it as a new sound, or zero if the user cancels4406969
\ No newline at end of file