Every time I try to run './synthesize jeopardy.wav < songs/jeopardy.txt' it just prints out:
helpers.c:46:17: runtime error: load of null pointer of type 'char'
Segmentation fault
here is my code:
int frequency(string note)
{
int A4 = 440;
char letter[2];
letter[0] = note[0];
letter[1] = '\0';
float steps = 0;
float hertz = 0;
float thertz = 0;
switch (letter[0])
{
case 'A':
steps = 0;
break;
case 'B':
steps = 2;
break;
case 'C':
steps = 9;
break;
case 'D':
steps = 7;
break;
case 'E':
steps = 5;
break;
case 'F':
steps = 4;
break;
case 'G':
steps = 2;
break;
default:
return 1;
}
if (atoi(¬e[strlen(note) - 1]) < 4)
{
for (int i = 0; i < atoi(¬e[strlen(note) - 1]); i++)
{
hertz = 440 * 2;
}
}
else if (atoi(¬e[strlen(note) - 1]) > 4)
{
for (int j = 4; j < atoi(¬e[strlen(note) - 1]); j++)
{
hertz = 440 / 2;
}
}
else
{
hertz = 440;
}
if (note[1] == '#')
{
if (note[0] == 'A')
{
thertz = round((pow(2, ((steps + 1) / 12))) * hertz);
return thertz;
}
else
{
thertz = round(hertz / (pow(2, ((steps - 1) / 12))));
return thertz;
}
}
else if (note[1] == 'b')
{
if (note[0] == 'B')
{
thertz = round((pow(2, ((steps - 1) / 12))) * hertz);
return thertz;
}
else
{
thertz = round(hertz / (pow(2, ((steps - 1) / 12))));
return thertz;
}
}
else
{
if (note[0] == 'A')
{
thertz = round((pow(2, (steps / 12))) * hertz);
return thertz;
}
else
{
thertz = round(hertz / (pow(2, (steps / 12))));
return thertz;
}
}
return thertz;
}