Simple guitar in out code

Hi there,

I’ve tried a simple code for guitar in and out. I know this is crazy simple. I’m looking to do this before any buffer/attenuation questions arise.

Can anyone correct/provide code to do this.

I have audio in going to pin 16 and audio out going to pin 18. pin 20 and 40 to breadboard ground.

Here is the .cpp

#include “daisysp.h”
#include “daisy_seed.h”

using namespace daisysp;
using namespace daisy;

static DaisySeed seed;

static void AudioCallback(float *in, float *out, size_t size)
{
for(size_t i = 0; i < size; i += 2)
{
out[i] = in[i];
}
}

int main(void)
{
// initialize seed hardware.
seed.Configure();
seed.Init();

//set blocksize.
seed.SetAudioBlockSize(48000);

// start callback
seed.StartAudio(AudioCallback);

while(1) {}
}

do i need the makefile? i have set up as below…

Project Name

TARGET = will_guitar_in_out

Sources

CPP_SOURCES = will_guitar_in_out.cpp

Library Locations

LIBDAISY_DIR = …/…/libdaisy
DAISYSP_DIR = …/…/DaisySP

Core location, and generic makefile.

SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile

Pic of the breadboard

Any help greatly appreciated!
Will

It looks correct, except for the seed.SetAudioBlockSize(48000); that you should omit. It is very long and will cause 1 s latency between input and output, which is generally not what you want. Anyway the value will be internally clipped by DSY_AUDIO_BLOCK_SIZE_MAX (defined in hid_audio.h) which is set to 128. If you don’t have a specific reason to change the block size, you should let libdaisy set the default value.

For sanity, I wouldn’t let pin 17 (right audio input) floating, just connect it to the ground.

You don’t need the makefile, but it will really simplify your task.

Hi there… am i missing something? i can’t get this code to work… there appears to be no signal coming in our out of the board?!!

Have you tried to make work some of the seed examples?

1 Like

I got the drum example working… the two button one.

Most seem to be set up as synth examples, eg. The bitcrush example. I can’t see which example would give the set up for a simple in/out …

any ideas on an example… simple starting point? :slight_smile:

Your code is basically correct. I ran it here on my Pod, I only needed to change
#include “daisysp.h”
#include “daisy_seed.h”

to

#include <daisysp.h>
#include <daisy_seed.h>

This change tells the compiler to look for these files in the ‘usual’ location. Using quotes, instead of brackets, tells the compiler to look ‘here’ first. It’s used when you have header files specific to only the current program.

So, the problem is most likely your wiring of the jacks.

Where would be the ‘usual’ location for these files? I wonder if mine are not located correctly.

I can run the Drum example and use my jack connection to run signal into an amp. So not sure if jack sockets are the issue?!

On my system (MacOS 10.14.6) , libdaisy and DaisySP directories are installed in the DaisyExamples directory. The makefiles and configuration files expect to find these header files under these locations.

If the Drum example plays, your output jack is likely correctly wired. But maybe your input jack isn’t? Also, if you are plugging in a mono source, be sure you know if it’s going to the L or R channel, and code accordingly.

Ok, so i’m a noob… at best!

I have been uploading my own .cpp file via the browser Programmer, not the .bin!

I’ve searched high and low, but could someone give a simple .cpp compiler instruction to generate the .bin. I know i could benefit from this!

Cheers, Will

Being a noob is fine (everyone was there), not reading documentation is not so fine. So you should start with official wiki info

Once you get to the point where you can compile Daisy examples, you should be able to create and build your own code.

1 Like

Yep! I hear you… I did read the documentation a number of times but i didn’t get that the ‘make’ would sort the problem. Lol!

I appreciate your support, Cheers, Will

1 Like

It’s not just sorting the problem - it’s what actually launches the build process. There’s also rebuild_examples.sh script in that repo which just iterates over all devices and their examples and runs “make” in every directory. You should probably use this instead of building every example manually.