Questions tagged [frequency]
The frequency tag has no usage guidance.
21 questions
0
votes
1
answer
45
views
Need help with Frequency in pset3. Been stuck for a while
So to start off, I'm going to include my code at the end of the question.
Basically, I've built this function a few times now and I'm kind of at my wits end here.
My code uses a for loop to iterate ...
0
votes
1
answer
55
views
CS50 Pset 3 Music errors - please help! :(
I really don't know what I am doing wrong. I think I've mad a mistake in frequency.
Check50 says:
:( note C3 has frequency 131
expected "131", not "220"
:( note Bb5 has frequency 932
...
0
votes
1
answer
50
views
Pset3 Frequency Algorithm
I was working through the Pset3 Algorithm, and have all ready written my code, and when check50 runs, I did pretty well. However, the check states that
:( produces all correct notes for octaves 3-5
...
0
votes
0
answers
25
views
Pset3---My programme is not compiling
I am not being able to understand the correct usage of get_base_frequency.
Please help! Thankyou
0
votes
1
answer
64
views
Music frequency accidental and note issue
My music program currently returns values for all notes and accidentals that equals the frequency of note A in that octave, but I cannot make the frequency output change for different notes or ...
0
votes
1
answer
173
views
pset3 load of null pointer of type 'char'
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:...
0
votes
1
answer
82
views
Calculate n (semitones) for frequency in pset3
I'm having a bit of a hard time trying to calculate the value of n(the number of semitones from A4).
I'm currently using the following formula:
if (octave > A4_OCTAVE)
{
n = (octave - ...
0
votes
1
answer
286
views
pset3 music frequency question
I am working on pset3 music frequency. I struggled with finding a pattern of frequencies for different notes, so instead, i created two arrays one with all possible note (C,D,E,F,G,A,B) and another ...
0
votes
1
answer
98
views
Writing the .wav file fails with command-line notes
I have verified that my frequency(note) function returns the correct frequency as an int. However, when I attempt to write out using the "command-line note entry" testing scenario described (and yes ...
0
votes
3
answers
141
views
cs50 music only frequency of A notes returned
could you please help. I just don´t understand why only A notes are calculated. Please see code below. Many thanks for your help in advance.
//Program to calculate note frequency
...
0
votes
2
answers
72
views
pset3 music - unsure what is wrong with my variables
I'm trying to shift the octave of the note and calculate its hertz, but somehow got error messages saying that my variables are unused. How should I fix this problem?
My code:
// Calculates ...
0
votes
0
answers
118
views
pset3 frequency: adjusting semitones
My code for Frequency is working well in the 4th Octave as well as any A note, but after that I am getting values all over. I used Debug50 to follow the math, and I've boiled it down to the adjustment ...
0
votes
1
answer
571
views
Pset3 Music frequency returns all 440
My frequency function returns all 440. Been researching and trying possible solutions (turn ints to floats, round, power, etc) but still does it. What am I doing wrong? Thank you!
int frequency(...
0
votes
2
answers
133
views
pset3 frequency not calculating correctly or adjusting for octaves
Can someone please look at my helpers.c code for pset3? I worked a lot on this and I am stuck. 'wavelength' (which is frequency) doesn't calculate correctly within octave 4, and my code to add or ...
0
votes
1
answer
27
views
Why are these if-else statements not letting my program compile?
I was wondering what is wrong with these if else statements because this program is not compiling. Any information would be appreciated and any advice please.
#include <cs50.h>
#include <...
0
votes
1
answer
1k
views
Pset3 music frequency
I'm certain my code is waaaay too long for what they are asking me to do, but I'm not sure how to change the thought process. In any case, my check comes back with huge numbers, so the math is wrong ...
0
votes
1
answer
127
views
PSET3 - Frequency giving wrong octave result
I've been trying to figure out the frequency part of this problem, and all of it seems to be running fine as far as I can tell, except for one part: my octave variable is not giving me anything close ...
0
votes
1
answer
223
views
My music program: frequency returning zeros
// Calculates frequency (in Hz) of a note
int frequency(string note)
{ int n,r,a;
double oct, z;
float x = 0.0;
float y = 0.0;
char t;
t=0;
a = 0;r = 0;
n = strlen (note)...
0
votes
1
answer
508
views
Problem with pow() function, int frequency, helpers.c, pset3, music
I'm not getting the correct frequencies. When I execute ./notes, C4 through G#4 all return 220, and A4 through B4 return 440.
I've determined that the problem must be with pow(), I just don't know ...
0
votes
2
answers
253
views
signed integer overflow
I have condition to give me Hz of the octave but I got an error 51:16: runtime error: signed integer overflow: 1845493760 * 2 cannot be represented in type 'int' for line
for (int j = 0; 4 + j < ...
2
votes
1
answer
844
views
Pset3 Helpers.c Frequency Not Working
Right now I am working on Pset3 with Music. I'm focusing on getting the frequency (in Hz) of all the octaves of A. I am including accidentals in my work as well.
The problem is that A4 returns 449 ...