sensorium / mozzi Goto Github PK
View Code? Open in Web Editor NEWsound synthesis library for Arduino
Home Page: https://sensorium.github.io/Mozzi/
License: GNU Lesser General Public License v2.1
sound synthesis library for Arduino
Home Page: https://sensorium.github.io/Mozzi/
License: GNU Lesser General Public License v2.1
Wonderful project, thank you so much! I get an error trying to compile my sketch, which I believe is from the Mozzi library:
Users/JeffThompson/Documents/Arduino/libraries/Mozzi/MozziGuts.cpp: In function 'void startAudioStandard()':
/Users/JeffThompson/Documents/Arduino/libraries/Mozzi/MozziGuts.cpp:285:9: error: 'class TimerOne' has no member named 'initializeCPUCycles'
Timer1.initializeCPUCycles(16000000UL/PWM_RATE, FAST); // fast mode enables higher PWM rate
^
/Users/JeffThompson/Documents/Arduino/libraries/Mozzi/MozziGuts.cpp:285:50: error: 'FAST' was not declared in this scope
Timer1.initializeCPUCycles(16000000UL/PWM_RATE, FAST); // fast mode enables higher PWM rate
^
exit status 1
Error compiling.
Is this an issue with the library?
Is it possible to make Mozzi available under GPL license? That would make it possible to combine with GPL licensed code. The CC-BY-NC-SA is not compatible with GPL.
Creative Commons itself "recommends and uses free and open source software licenses for software."
I want to publish ESP32 support for Mozzi using the ESP8266Audio library, which is GPL licensed. Mozzi could add the GPL as an option in addition to the existing license.
Hello, I am on mac with mavericks with IDE 1.0.6
This is the Error message I got when choosing the Mozzi.zip file for library import.
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:128)
at java.util.zip.ZipFile.(ZipFile.java:145)
at processing.app.tools.ZipDeflater.(ZipDeflater.java:25)
at processing.app.Base.handleAddLibrary(Base.java:2397)
at processing.app.Base$4.actionPerformed(Base.java:959)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
at com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95)
at java.awt.MenuItem.processActionEvent(MenuItem.java:650)
at java.awt.MenuItem.processEvent(MenuItem.java:609)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:343)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:331)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:720)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Can you help me make sense of this, Thank you.
Hello,
First off, thanks to all developers for a wonderful library!
I've been trying to use it with Teensy LC. After scaling the audio data to 12-bit range, I can get a sound from a simple sample playback and an oscillator.
However, if I try to load a sample larger than 8kB, Teensy seems to freeze once I initialize Sample
with that data. My understanding is that samples are read directly from flash, is that not the case? Teensy LC has 8kB RAM and 62kB flash, according to the specs.
I'm experiencing this e.g. with the Sample
sketch that uses burroughs1_18649_int8
table. I'd appreciate any pointers as to what might be the issue here.
I am using the latest version downloaded from github.
Hello guys
I'm developing an oscillator that have many wavetables that dont fit into board memory.
I can load then from SD card because this operation is made in "stand by" mode , so I can stop all oscillators and change my wavetables .
But , I cant figure out how to read a new wavetable that wasnt loaded at compile time.
Any clue ?
Thank you!!
I have eurorack module using pin 11 for output ( phase-correct ). Current code looks like:
#define PWM_PIN 11
#define PWM_VALUE OCR2A
void audioOn() {
// Set up PWM to 31.25kHz, phase accurate
TCCR2A = _BV(COM2A1) | _BV(WGM20);
TCCR2B = _BV(CS20);
TIMSK2 = _BV(TOIE2);
}
void setup() {
pinMode(PWM_PIN,OUTPUT);
audioOn();
}
SIGNAL(PWM_INTERRUPT) {
// get output value logic..
PWM_VALUE = output;
}
Having hard times figuring out how to run Mozzi on it. Is it possible? Sorry if noob question or unrelated.
What was the closest you managed get to 303 sound? :-) I know this is not exactly easy task.
But do you have some example sketches or tricks and tips on how to mimmick that sharp chirping bass of Roland using Mozzi?
I'm getting started using mozzi but as soon as I add the library manually or via zip it crashes everything.
By elimination it led me to line 8 (version info) of the library properties. Not sure what's wrong with it but after deleting it it loads Arduino IDE.
I'm using windows 10
this is the line I deleted "version=version 2013-07-07-17:51 "
I'm new in Mozzi. I've experimented with code and tried to pass FM-modulated signal across StateVariable filter. Then I discovered strange clicking sound on output. Moreover it is present only if I call next() for another Oscill else (when I comment this //char s2 = sig2.next(); ) it is ok. The same behavior is in Proteus when I simulate ATMega2560. Please help me to solve that problem. Code:
Oscil <512, AUDIO_RATE> sig1(SIN512_DATA);
Oscil <512, AUDIO_RATE> sig2(SIN512_DATA);
Oscil <512, AUDIO_RATE> fmVib(SIN512_DATA);
StateVariable svFilter;
void setup(){
startMozzi();
fmVib.setFreq(10);
sig1.setFreq(880);
sig2.setFreq(440);
svFilter.setResonance(100);
svFilter.setCentreFreq(1500);
}
void updateControl(){
}
int updateAudio(){
long vibrato = 300 * fmVib.next();
char s2 = sig2.next();
int unfiltered = (int) sig1.phMod(vibrato);
int filtered = svFilter.next(unfiltered);
return filtered >> 2;
}
void loop(){
audioHook();
}
I want to control mozzi reading raw data, but when I include wire.h library I got thia error while compiling:
libraries\Wire\utility\twi.c.o: In function `__vector_24':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility/twi.c:384: multiple definition of `__vector_24'
libraries\Mozzi-master\twi_nonblock.cpp.o:C:\Program Files (x86)\Arduino\libraries\Mozzi-master/twi_nonblock.cpp:456: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
Since i think there’s a conflict between the libraries, Is there any way to read raw directly using mozzi libraries or read raw data without wire.h?
Hi all,
I've tried to use the AudioDelayFeedback example on GitHub for implement my code with a delay.
So i want to learn the basic form of delay.
Using the AudioDelayFeedback example i would like to create a sketch that only reproduce the signal delayed after release the button.
When i press the button, i want only signal in my ear.
If i try to use the delay only option in the output part of the code, i recive an error.
The error is:
testdelay:57:47: error: call of overloaded 'next(int8_t, byte&)' is ambiguous
return aDel.next(aTriangle.next(), del_samps); // instead of the previous 2 lines for only the delayed signal
^
In file included from C:\Users\User\Documents\Arduino\testdelay\testdelay.ino:18:0:
C:\Users\User\Documents\Arduino\libraries\Mozzi-master/AudioDelayFeedback.h:92:10: note: candidate: int16_t AudioDelayFeedback<NUM_BUFFER_SAMPLES, INTERP_TYPE>::next(int8_t, uint16_t) [with unsigned int NUM_BUFFER_SAMPLES = 128u; signed char INTERP_TYPE = 0; int16_t = int; int8_t = signed char; uint16_t = unsigned int]
int16_t next(int8_t input, uint16_t delaytime_cells)
^
C:\Users\User\Documents\Arduino\libraries\Mozzi-master/AudioDelayFeedback.h:117:10: note: candidate: int16_t AudioDelayFeedback<NUM_BUFFER_SAMPLES, INTERP_TYPE>::next(int8_t, Q16n16) [with unsigned int NUM_BUFFER_SAMPLES = 128u; signed char INTERP_TYPE = 0; int16_t = int; int8_t = signed char; Q16n16 = long unsigned int]
int16_t next(int8_t input, Q16n16 delaytime_cells)
^
exit status 1
call of overloaded 'next(int8_t, byte&)' is ambiguous
My code is:
/* Example of flanging,
using Mozzi sonification library.
Demonstrates AudioDelayFeedback.
Circuit: Audio output on digital pin 9 on a Uno or similar, or
DAC/A14 on Teensy 3.1, or
check the README or http://sensorium.github.com/Mozzi/
Mozzi documentation/API
https://sensorium.github.io/Mozzi/doc/html/index.html
Mozzi help/discussion/announcements:
https://groups.google.com/forum/#!forum/mozzi-users
Tim Barrass 2012-13, CC by-nc-sa.
*/
#include <MozziGuts.h>
#include <Oscil.h>
#include <tables/triangle_analogue512_int8.h> // wavetable
#include <tables/triangle512_int8.h> // wavetable
#include <AudioDelayFeedback.h>
#include <mozzi_midi.h> // for mtof
#define CONTROL_RATE 128 // Hz, powers of 2 are most reliable
Oscil<TRIANGLE_ANALOGUE512_NUM_CELLS, AUDIO_RATE> aTriangle(TRIANGLE_ANALOGUE512_DATA); // audio oscillator
Oscil<TRIANGLE512_NUM_CELLS, CONTROL_RATE> kDelSamps(TRIANGLE512_DATA); // for modulating delay time, measured in audio samples
AudioDelayFeedback <128> aDel;
// the delay time, measured in samples, updated in updateControl, and used in updateAudio
byte del_samps;
void setup(){
startMozzi(CONTROL_RATE);
aTriangle.setFreq(mtof(48.f));
kDelSamps.setFreq(.163f); // set the delay time modulation frequency (ie. the sweep frequency)
aDel.setFeedbackLevel(-111); // can be -128 to 127
}
Q16n16 deltime;
void updateControl(){
// delay time range from 0 to 127 samples, @ 16384 samps per sec = 0 to 7 milliseconds
del_samps = 64+kDelSamps.next();
// delay time range from 1 to 33 samples, @ 16384 samps per sec = 0 to 2 milliseconds
//del_samps = 17+kDelSamps.next()/8;
//deltime = Q8n0_to_Q16n16(17) + ((long)kDelSamps.next()<<12);
}
int updateAudio(){
char asig = aTriangle.next(); // get this so it can be used twice without calling next() again
//return asig/8 + aDel.next(asig, del_samps); // mix some straight signal with the delayed signal
return aDel.next(aTriangle.next(), del_samps); // instead of the previous 2 lines for only the delayed signal
//return asig/8 + aDel.next(asig, deltime); // mix some straight signal with the delayed signal
}
void loop(){
audioHook();
}
How i can fix it?
\Mozzi\MozziGuts.cpp:378:51: error: 'i2s_lr' was not declared in this scope
i2s_lr((uint16_t) (updateAudio() + AUDIO_BIAS), 0);
I've changed to
i2s_write_lr((uint16_t) (updateAudio() + AUDIO_BIAS), 0);
and now compliing is done but sound is a bit distorted.
MCP49xx dac feature is awesome. In fact, examples like fmsynth on atmega328 + MCP49xx sounds much better than ESP8266 + PT8211 so there must be something wrong on code, but I can't find it.
I've been seeing a few 404s in the documentation. Example: click the hyperlink to MozziGuts.h
(at the bottom of the CONTROL_RATE
section). It links to this url which is 404.
Weirdly, the file does exist in the repo.
My feeling is that the underscore at the beginning of the file is creating an issue. Actually, that's most probably it -- see here!
Probably that adding a .nojekyll
file to the root path (as instructed in the page linked above) would be the simplest thing to do..?
Hi,
First of all thanks for this great library!
I have an error to report: when switching to hifi mode, arduino gives an error about variable num_out not being defined in MuzziGuts.cpp line 201
the variable's name is probably deprecated, i managed to fix it by looking at the code for standard audio
still wanted to point this out to you.
cheers
Thomas
Hi I connected a jack back into my powermac - it had two cables the black to ground and the other to pin 9 on an Arduino demimilanove - i was getting a readout from my input level meter in the sound input window in Powerbooks system prefs. But no sound !!
you mention running it through audacity? is this for playback or have i missed something fundamental
thanks
Frank
I've found a way to configure AUDIO_MODE in sketches instead of editing mozzi_config.h. AUDIO_MODE will be STANDARD_PLUS by default. Including a file called hifi.h in the first line of the sketch will set it to HIFI.
Old HIFI sketches would need to be updated, but it's a simple fix which a compiler warning could also advise.
Would it be better to require the config file also for STANDARD_PLUS, so AUDIO_MODE is always explicit in the sketch? It would break more sketches but is more consistent.
Any suggestions are welcome.
If there are no objections I'll go ahead as I think it's a good improvement in usability.
Hi!!! Thanks for this awesome library, it rocks!!! :)
Would it be possible to add support for make it work in a ESP8266 board? ESP8266 is much more powerful than Arduino ande it has WiFi and MIDI over WiFi compatibility. I think it will be a superb combination :)
What should I do for making Mozzi compatible with ESP8266??
Thanks
I'd like to make a new release soon, as I've had reports that v1.0.3rc6 is not working in some situations and Mozzi has developed with Thomas' work particularly in the last 2 years.
Are there any concerns or suggestions towards getting the release together with the current development code?
I don't know how many people are playing / will be playing with Mozzi on different CPUs, but one of the annoying aspects while cross-testing is that different ports expect a different audio resolution to be returned from updateAudio(). The same problem applies when switching between available audio configurations on the same CPU.
An example written for StandardPlus (8.5bits or so) will be somewhat quiet on the STM32 (10 bits), very quiet on the Teensy (12 bits), definitely too quiet in HIFI mode (14 bits), and barely audible on the upcoming ESP8266 port (16 bits). That's rather sad, as everything else in a typical Mozzi sketch can be expected to work, unchanged. You would not believe how many times I went hunting for "what did I break now" while cross-testing, when the whole problem was that I forgot to adjust updateAudio() to my current configuration. I wonder how many users will experience similar woes when trying something new. Another symptom of this problem is "duplicate" examples for standard and HIFI modes.
So: Wouldn't it be cool, if Mozzi could do the necessary scaling all automatically? (Yeah!) But how?
// Assume that "value" is scaled to "bits" resolution, and scale it to the output resolution appropriate for the current configuration
// As long as bits is a compile time constant, the compiler should be smart enough to optimize this to a static shift operation (or nothing)
#define SCALE_AUDIO(bits, value) ((bits < AUDIO_BITS) ? (value << (AUDIO_BITS-bits)) : ((bits > AUDIO_BITS) ? (value >> (bits-AUDIO_BITS)) : value))
#define SCALE_AUDIO8(value) SCALE_AUDIO(8, value)
#define SCALE_AUDIO16(value) SCALE_AUDIO(16, value)
Then to "opt-in" to auto-scaling, users would be encouraged to wrap the return value in updateAudio() like this:
int updateAudio() {
int ret = [terribly complicated maths resulting in 13 used bits];
return SCALE_AUDIO(13, ret);
}
The third approach is much better, IMO:
Now, that's all fine and dandy, but then there's the (important!) special case of "StandardPlus", where the supported audio output resolution is "almost, but not quite 9 bits". There, we cannot assume that we can safely shift samples to 9 bit resolution, but shifting everything to 8 bits would be wasteful. What to do?
Looking at the existing examples for StandardPlus, these seem to fall into two categories: a) One simply returns exactly 8 bits, assuming the full range will be used - e.g. direct output from an Oscil. b) The other category returns values that will not usually, but might reach 9 bits. E.g. "08.Samples/Samples_Tables_Arrays". Here, the return value is constrain()ed to the actual -243..244 range before returning.
My current idea is to for dealing with this is (I hope I'm explaining it well):
SCALE_AUDIO(8,...)
or SCALE_AUDIO8(...)
, which will be set to not do any scaling for StandardPlus, or more precisely, this will shift to a target level of 8 bits in StandardPlus (if necessary). On other ports/configurations, the input will be scaled as shown above.SCALE_CLIP_AUDIO(9,...)
or SCALE_CLIP_AUDIO9(...)
. This will signify that the supplied values will have around 9 bits, possibly even more, but usually less. It will (not) shift to a target level of 9 bits in StandardPlus, but also add add a constrain(). On other ports/configurations, the input will be scaled as if it was 9 bits (and also constrained).Your thoughts?
Changing the wavetable from sin2048_int8 to sin256_int8 in the _01_Sinewave example, you can hear a very detuned A4 sound (a G4, actually).
Can it be some kind of bug or is there some explanation for this behaviour?
Hint: at higher frequencies (tested 880+) the detuning shortens to a half tone.
I downloaded the "most recent version" from https://sensorium.github.io/Mozzi/download/
I am getting this message in Arduino:
Invalid version 'version 2013-07-07-17:51' for library in: /Users/skybrian/Documents/Arduino/libraries/Mozzi
I looks like this was fixed many years ago and the zip file there might not actually be the most recent release? libraries.properties on GitHub says 1.0.3 and looking at the GitHub releases tab, 1.0.2 seems to be the most recent stable release.
Thanks for the ESP8266 Support but the ESP32 is better in every manner.
First off: the Mozzi Library is amazing and I am very grateful to everyone involved in the creation and the port to the Teensy 3.6, which I am using.
My problem in short:
when using the Mozzi Library, I am unable to read the analog input values of pins 39-33.
Project: I am trying to create a monophonic 4 oscilator (+1 Sub) synthesizer with variable volume and detune per oscilator, an LFO for modulating the pitch and filter cutoff, LowPassFilter, ADSR-Envelope, Midi-Capabilities and some analog audio effects.
Problem: The oscilator section and Midi work fine, so does the LFO. However, while implementing the filter, I ran into the issue. I tried to modulate the filter cutoff frequency with a potentiometer connected to pin 39 (also sometimes called A20). But it didn't work.
I tested the potentiometer before coding, and tested it again in a clean sketch. It seemed to be connected, but testing it in a sketch, which implements the Mozzi Library, it suddenly didn't work. (Testing by Serial.pintln(mozziAnalogRead(pin))). The other analog pins I used so far (pin14-13, A0-A9) work fine and were tested in the same manner.
Question: Is anyone else having the same issue? What could I do?
Example codes on the documentation are not copy-pastable.
Is it by design ?
What license is this code distributed under?
I am trying to get Mozzi running with a teensy2 but i get this error message.
Mozzi/mozzi_analog.cpp.o: In function adcStartConversion(unsigned char)': .../Documents/Arduino/libraries/Mozzi/mozzi_analog.cpp:115: undefined reference to
analog_pin_to_channel_PGM'
A fix found in a issue opened by Nanoblender does not seem to work.
Problem
The examples
/examples/06.Synthesis/AMsynth
and
/examples/06.Synthesis//AMsynth_HIFI
contain basically the same bug. In line 48 respectively 23, the include
#include <tables/COS2048_int8.h>
is written in capital letters. The actual file name however is cos2048_int8.h
. This leads to a file not found error while compiling under linux and probably also OSX since both systems are case-sensitive in contrast to Windows.
My system
Ubuntu 12.4, 64-Bit.
Arduino 1.0.5
On an Arduino Diecimila (ATmega168), when running the Example sketches, I hear a high pitched squeal somewhere in the vicinity of dog-whistle frequency space.
Is the library specific to certain Arduino boards (e.g. for timing purposes) ?
Hello!
I've tried this method for switching out pin 9 for pin 10 : https://groups.google.com/forum/#!topic/mozzi-users/p3q2QSCcuzU
When I tried an example, the audio is still coming from pin 9. Is there something that I've missed?
Hi to all,
I have read in the documentation that the test on the Teensy LC has been carried out with positive result, but it does not result anywhere how to configure it.
If I try to follow the documentation regarding the changes needed to use a Teensy, I have a lot of compiling problems.
The wording on the https://sensorium.github.io/Mozzi/ page also speaks of Teensy LC. Is this an error or can I not find the specific documentation?
Using a Teensy 3.5, I started going through the Mozzi tutorials and examples, everything was fine. Went back 2 days later and suddenly nothing will compile. I've tried fully uninstalling Arduino, Teensyduino and Mozzi and reinstalling different versions. Always the same result. Basic Arduino sketches are uploading so I'm guessing it's not a board/port issue.
Arduino: 1.6.12 (Mac OS X), TD: 1.31, Board: "Teensy 3.5, Serial, 120 MHz, US English"
WARNING: Category 'Sound' in library Mozzi is not valid. Setting to 'Uncategorized'
In file included from /Users/joaoorecchia/Documents/Arduino/libraries/Mozzi/twi_nonblock.cpp:12:0:
/Users/joaoorecchia/Documents/Arduino/libraries/Mozzi/twi_nonblock.h:17:24: fatal error: compat/twi.h: No such file or directory
#include <compat/twi.h>
^
compilation terminated.
Error compiling for board Teensy 3.5.
Hello,
I tried to Upload some Mozzi examples to my teensy 2 but i can't compil them and i get this message:
C:\Documents and Settings\Me\Mes documents\electronique\teensy\arduino-1.0.1\libraries\Mozzi\utils.cpp: In function 'void startAnalogRead(unsigned char)':
C:\Documents and Settings\Me\Mes documents\electronique\teensy\arduino-1.0.1\libraries\Mozzi\utils.cpp:314: error: 'analogPinToChannel' was not declared in this scope
Sorry my english is bad.
I have tried several routes to install scikits.audiolab so that I can run audio2huff.py script and use some longer samples, but am still unable to do this.
mozziAnalogRead() is currently limited to "AV CC with external capacitor at AREF pin" (REFS[1:0] = 00) as the ADC reference voltage. Setting a reference via Arduino's analogReference() is ignored. Setting REFS[1:0] in ADMUX manually is also overwritten in adcSetChannel()
Line 138 in 83a929d
There should be at least a warning about this unexpected behavior, since sources connected to AREF could get damaged by getting their output connected to AVCC inside the MCU when calling mozziAnalogRead().
After creating a .h file with a wave table, in python, my sketch compiles with no errors in the arduino environment, but when I upload to the arduino board I get an error:
Binary sketch size: 19,340 bytes (of a 258,048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: verification error, first mismatch at byte 0x4135
0x01 != 0xff
avrdude: verification error; content mismatch
Have you seen this before, or know what could be going on?
Thanks,
r
Well Teensy 4.0 is a thing and on the website for Mozzi it only lists Teensy 2.0 and 3.0. I'm a little confused if it will ever get support. Also i cant just try to use the 3.0 stuff because for some reason it only has A0 to A13.
Mozzi Pins
Teensy2, 2++ | B5 (25)
Teensy3.x | A14 (analog out)
link to pin out
https://www.pjrc.com/store/teensy40.html
Steps to reproduce:
Expected result:
Actual result:
Note: After problem has occurred to reflash the nanosynth you need to hold down the reset button, and release it only when the new sketch is shown as "uploading" in the Arduino IDE.
I have identified a strange problem running mozzi on STM32. Playing a Sample or an Oscil is slightly faster than it should be (exactly 1.5% faster). For example, if I make a sketch that plays a sinewave at 440 Hz, on the AVR I obtain a correct 440 Hz sinewave, the same sketch running on a STM32 produces a 447Hz sound.
I verified this is independent from audio mode (HIFI or STANDARD_PLUS), and independent from the actual wavetable used.
Hi,
First of all my compliments for this brilliant library.
I am using mozzi to create an electronic hurdy gurdy, where I am generating the sound of two strings with mozzi, based on the speed of an encoder. I use 1 Arduino for running mozzi (Duemilanove with ATmega168), and a second Arduino to read the encoder (Arduino Pro Mini 328), because I didn't want to mess up Mozzi with the interrupts that I need for the encoder.
On the second Arduino I calculate the speed of the encoder, and I send it over a serial link to the first arduino, to change the sound based on the speed.
I set everything up in 'standard' mode, and it was working fine (except for my wife complaining about the high-pitched squeal). Then I switched to hifi mode, including the proposed filtering. I checked this on a single Arduino, and it works fine.
BUT: for some reason my serial communication has stopped working. I have double checked, and it seems that switching to hifi mode kills my serial communication. Is this a known fact with an existing work around? Advice is much appreciated.
Jaap
HIFI examples which used to output audio without major distortion now overflow. The examples work when the audio in the sketches is right shifted >> 1. Not sure if the old behaviour was incorrect and the examples should be adjusted, or if the newer code has introduced an error.
Line 499 in 1f49dc1
I have a teensy 2++, and I can't seem to load Mozzi on it and get sound output. The built-in USB support (act as a USB MIDI device) and low cost make this an awesome platform for Mozzi. I also have atmega8, 168, & 328s for testing compatibility, if more hardware testing needs to be done.
Just downloaded the latest release. Unfortunately, this error shows up:
WARNING: Category 'Audio' in library Mozzi is not valid. Setting to 'Uncategorized'
Will it affect anything? If so, how can this be fixed?
Hi,
it seems that Mozzi has trouble to support Gemma M0 boards. Compilation aborts because the file <util/atomic.h> is missing. As it has been tested and verified as working, I tried with others release, without any improvement.
Nice tool btw !
I am trying to build a multi-channel synth (4 voices with choice of whatever wave-table you want.) To make it simple, I am using all 512-sized wave-tables. I want to define each channel as a struct, like this:
#include <tables/sin512_int8.h>
#include <tables/saw_analogue512_int8.h>
#include <tables/triangle_analogue512_int8.h>
#include <tables/square_analogue512_int8.h>
#define SIN 0
#define SAW 1
#define TRI 2
#define SQR 3
#define VOICE_COUNT 4
struct {
byte gain;
int freq;
byte wavenum;
} channel[VOICE_COUNT] = {0, 440, SIN};
I imagine that things like this would be happening in updateControl():
void updateControl(){
channel[1].gain = 1;
channel[1].wavenum = TRI;
channel[1].freq = mtof(64);
}
I am having trouble understanding how to init Oscil() into an array structure (in example: wave_tables,) so in my updateAudio() I can just do this:
int updateAudio(){
output=0;
for(i=0;i<VOICE_COUNT;i++){
if (channel[i].gain != 0){
wave_tables[ channel[i].wavenum ].setFreq(channel[i].freq);
output += wave_tables[ channel[i].wavenum ].next() * channel[i].gain;
}
}
return output;
}
I don't understand how to make wave_tables array. Am I thinking about this the wrong way? Do I need to do something with pointers or manually mess with phase?
Hello,
I'm trying to use Mozzi on arduino DUE, the code compiles Ok, but when I try to upload it I get this error, any ideas on how to deal with this?
Arduino: 1.6.1 (Mac OS X), Board: "Arduino Due (Native USB Port)"
WARNING: library Mozzi claims to run on [avr] architecture(s) and may be incompatible with your current board which runs on [sam] architecture(s).
In file included from mozzi_basic.ino:2:0:
/Users/cavadagonzalo/Documents/Arduino/libraries/Mozzi-master/Oscil.h:24:25: fatal error: util/atomic.h: No such file or directory
#include <util/atomic.h>
^
compilation terminated.
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Thanks in advance for any help with this!
Sei, não é exatamente um issue. Acho que outros podem pesquisar sobre isso.
Porque eu tenho visto algumas placas baseadas em Arduino UNO com este processador "atmega16u2" e não com tradicional "atmega328p-pu".
Running Arduino on Ubuntu 12.04, received:
~/arduino/libraries/Mozzi/MozziGuts.cpp:24:23: fatal error: Mozziguts.h: No such file or directory
Changing line 24 of MozziGuts.cpp to
resolves the problem. Easy fix.
Arduino 1.8.1
Mozzi 1.0.3rc4
Windows 10
Examples work fine in the default STANDARD_PLUS mode, but when attempting to compile any example in HIFI mode (by setting it in the mozzi_config.h file), it produces the following error:
`In file included from C:...\Arduino\libraries\Mozzi-1.0.3rc4\MozziGuts.cpp:13:0:
C:...\Arduino\libraries\Mozzi-1.0.3rc4\MozziGuts.cpp: In function 'void setupTimer2()':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:104:37: error: expected unqualified-id before '(' token
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
^
C:...\Arduino\libraries\Mozzi-1.0.3rc4\MozziGuts.cpp:443:29: note: in expansion of macro 'clockCyclesPerMicrosecond'
period *= FrequencyTimer2::clockCyclesPerMicrosecond();
^
C:...\Arduino\libraries\Mozzi-1.0.3rc4\MozziGuts.cpp:444:2: error: 'setPeriod' is not a member of 'FrequencyTimer2'
FrequencyTimer2::setPeriod(period);
^
exit status 1
Error compiling for board Arduino/Genuino Uno.`
Hello,
I've successfully ran most Mozzi examples on an Uno. I am however having a problem running the same examples on an Adafruit Feather M0 (which uses an ATSAMD21G18 ARM Cortex M0 processor).
The audio does come out but it seems distorted. It was pretty clear when running the Sinewave example, but it became really obvious when running the Samples Tables Arrays examples (I'm running all examples as is).
Please see below (all recordings done on the same computer using the same USB interface):
Is there an obvious fix, or at least a direction that I could try looking into? Is this related to the onboard DAC (one of its settings)..?
Thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.