printf("The pitch is %f Hz.\n", pitch_Hz);
change_pitch:
float pitch_mult = pitch_Hz/midi_to_hz(argv[3]);
- pitch_mult = 2.0; /* testing */
+ pitch_mult = 1.2; /* testing */
printf("%f", pitch_mult);
int resampled_len = change_pitch(phoneme, ph_B, pitch_mult, NULL);
int16_t *resampled = malloc(resampled_len);
change_pitch(phoneme, ph_B, pitch_mult, resampled);
change_length:
- /* tba */
int final_B = (int)ceil(ß(argv[7]) * 88.200); /* have to set
calculate
length on UI
{
FILE *fp;
fp = fopen(fn, "wb");
+ /*
struct __attribute__((packed)) header {
const char riff[4];
const uint32_t riff_len;
};
int b_w = fwrite(&wavheader, 1, HEADLEN, fp);
if (b_w < HEADLEN) goto error;
+ */
+ const char riff_id[4] = {'R', 'I', 'F', 'F' };
+ fwrite(riff_id, 4, 1, fp);
+
+ const uint32_t riff_length = HEADLEN - 8;
+ fwrite(&riff_length, 4, 1, fp);
+
+ const char wave_id[4] = {'W', 'A', 'V', 'E'};
+ fwrite(wave_id, 4, 1, fp);
+
+ const char fmt_id[4] = {'f', 'm', 't', ' '};
+ fwrite(fmt_id, 4, 1, fp);
+
+ const uint32_t fmt_length = FMTLEN;
+ fwrite(&fmt_length, 4, 1, fp);
+
+ const uint16_t format_tag = 1; //microsoft PCM i think??
+ fwrite(&format_tag, 2, 1, fp);
+
+ const uint16_t channel_count = 1; //mono
+ fwrite(&channel_count, 2, 1, fp);
+
+ const uint32_t sampling_rate = 44100;
+ fwrite(&sampling_rate, 4, 1, fp);
+
+ const uint32_t bytes_per_second = 88200;
+ fwrite(&bytes_per_second, 4, 1, fp);
+
+ const uint16_t block_align = 2; //no idea what this means
+ fwrite(&block_align, 2, 1, fp);
+
+ const uint16_t bits_per_sample = 16;
+ fwrite(&bits_per_sample, 2, 1, fp);
+
+ const char data_id[4] = {'d', 'a', 't', 'a'};
+ fwrite(data_id, 4, 1, fp);
+
+ const uint32_t data_size = 0;
+ fwrite(&data_size, 4, 1, fp);
+
fclose(fp);
return 1;
error:
fwrite(&wavesize, 4, 1, fp);
/* should be right at the start of the wave :) */
- int w_i = fwrite(w, 2, w_B, fp); /* w_B 2byte items */
- if (w_i < w_B) goto error;
+ /* oop actually */
+ fclose(fp);
+ fp = fopen(fn, "ab");
+ int w_i = fwrite(w, 1, w_B, fp); /* w_B 1byte items */
+ if (w_i < w_B - 1) goto error;
fclose(fp);
return 1;
error: