Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Joshua Flynn

Pages: 1 2 [3] 4 5 ... 9
31
Audio / Re: Question on how audio is stored in SoundBuffer
« on: November 21, 2013, 05:10:06 pm »
Looking at the time domain is not a good idea for this kind of analysis. To investigate the distribution of different frequencies (i.e. pitch) across your signal, transform it into frequency domain -> Fourier Transform, as already mentioned by wintertime. You can use an existing FFT implementation from a C or C++ library.

I'm not smart enough to grasp Fourier Transform or other mathematical effects.

I find it easier if I devise my own solutions that I understand.

32
Graphics / Fade out image
« on: November 21, 2013, 05:08:49 pm »
I've got a loaded .png intro image. What's the easiest way to make it fade out to black using timers?

I want to try to avoid real-time image manipulation if possible as I find it resource intensive.

33
Audio / Re: Question on how audio is stored in SoundBuffer
« on: November 01, 2013, 12:02:56 am »
I'm looking to enable it to deal with more complicated things (such as verbal recordings) in order to detect pitch for the slightly less musical gifted (IE myself). The sine wave is just a starting base to figure the theory behind pitch detection (which I know is possible as I toyed with such software in the windows 2000/XP days).

Obviously the proper wav file won't be so clean (pops, crackles, low-level background noise, inconsistent pitch, silences etc).

I'm hoping to somehow 'average out' a specified section so it can give me the closest approximation to the pitch it thinks I'm attempting to 'sing'. Obviously I don't anticipate very noisy or poor noise:signal ratios but it won't be a clear-cut sine wave either.


Based on what I've learnt, I'm assuming the variables in the equation would be distance between the mid-range of two points and speed (closer the points, higher the speed, higher the pitch, further the points, slower the speed, lower the pitch).

34
Audio / Re: Question on how audio is stored in SoundBuffer
« on: October 31, 2013, 11:52:08 am »
Okay, thank you for the help so far.

So if I wanted to work out the pitch of a given sound piece (starting simple, let's say a basic 440hz sine wave loaded from a .wav file), how would I go about doing that?

35
Audio / Question on how audio is stored in SoundBuffer
« on: October 29, 2013, 12:44:29 am »
This assumes a SoundBuffer set with a channel count of 2 and a sample rate of 44100.

I'm trying to understand how audio is stored in SoundBuffer. So how are the numbers interpreted?

For example, if I had a sample array that contained 1000 Int16s, how do I know which is pitch, volume, channel, etc?

36
Graphics / Is there a way to take a screenshot of the entire screen?
« on: October 30, 2012, 03:51:35 pm »
What functions, etc would I be looking at?

37
Graphics / Re: SFML 1.6 Colour Issue?
« on: September 01, 2012, 08:22:40 pm »
Please show us a complete and minimal code that reproduces the problem.

Argh! I am sorry Laurent... SetColor... Why do I never notice these things?!

38
Graphics / SFML 1.6 Colour Issue?
« on: September 01, 2012, 02:07:24 am »
I have a sprite that loads from the image MapLayout, but on display in SFML it takes on a noticeably green tinge:





Why is SFML displaying it as green rather than yellow?

39
General / SFML 1.6 Mouse Coords Conversion
« on: August 31, 2012, 01:21:52 am »
I know 1.6 is 'old school', no worries. I'm aware there are some conversion issues between render window and the mouse coords if render window is resized.

Let's say I have an (invisible to the user) square/rectangular area within the screen, where if the user clicks within the area something happens. What is the best way to implement this so that, if a user resizes the screen, the area checking between both the square/rectangular area and the mouses coords is consistent regardless of how the window is resized? What SFML classes should I use for this?

40
Audio / Re: How do I seamlessly loop recorded sounds?
« on: August 30, 2012, 12:44:35 pm »
Thanks laurent! As it's a class I'll put it into an automated function.

41
Audio / Re: How do I seamlessly loop recorded sounds?
« on: August 30, 2012, 11:58:49 am »
I mean you should try with a sound loaded from a file, as opposed to a sound recorded by you. To know whether the problem is with recording or looping.

I analysed the recorded audio, and there's a few moments worth (0.5 of a second I think) of 'silence' where there is no recording occurring (as in no noise is being recorded, not even background noise). When the sound loops, the silence makes it sound like there's a gap.

If I remove this gap using an external audio program, the looping is fine.

Assuming the length of the silence is the same, is there a way to 'cut out' the first 0.5 second segment of the sound with SFML? I'm not bothered if cutting it off involves an expensive copying of an array as this isn't entirely concerned with efficiency, but I don't want to export to an external audio program to edit out silence.

42
Audio / Re: How do I seamlessly loop recorded sounds?
« on: August 29, 2012, 09:48:13 pm »
If by "seamless" you mean that silence at the beginning and the end of the sound should be trimmed away, that might be harder than it appears.

Generally, go at it like you were to trim a text string when you want to remove all leading and trailing whitespace: get the sample data of the recorded sample and "browse" through it until you find an actual sound sample (ie anything that is not silence) and save that position. Do the same in reverse, beginning at the end of the recorded sound. Use the positions that you saved to get a sub-sound of the recorded sound, that would be the trimmed sound that you could repeat "seamlessly".

The problem is that there is likely not going to be any true silence in the recorded sample but a certain amount of noise (especially when recording using a microphone). You will have to define a reasonable treshold where any sample that is quieter than the treshold will be considered absolute silence. It should not be too high, because that would trim away actual sound data, and it should not be too low either because then it won't fix the problem.

It also cannot be a fix value, because user A might speak louder than user B and the correct treshold would thus be different - so you'd have to do some pre-analysis of the sample as well (could be done while recording).

It's not recorded silence (that would generate static noise) unless it's system appended silence before the recording actually starts (that is entirely silent) - but I wouldn't know how to remove that. There's just a notable silent gap, not even background noise or static.

43
Audio / Re: How do I seamlessly loop recorded sounds?
« on: August 29, 2012, 09:45:20 pm »
Quote
SetLoop(true) does not give seamless looping
And you think it's SFML's fault? As far as I know, looping sounds loop perfectly (there's no lag between the end and the beginning). Couldn't it be something on your side? Does it work with a loaded sound rather than a recorded one?

A loaded sound?!

Sorry, what loaded sound?

Records the sound with SoundBufferRecorder, .GetBuffer() stores it in a SoundBuffer (SFML's own), passes that to Sound (SFML's own), sets the Sound with .SetLoop(true), then .Play(). Sound loops, there's a gap.  Why would it be anything on 'my side'? You make it sound like I'm trying to intentionally slur you or something.

 
    sf::SoundBufferRecorder Test;
    Test.Start();
    system("PAUSE");
    Test.Stop();
    sf::SoundBuffer Test2;
    Test2 = Test.GetBuffer();

    sf::Sound Test3;
    Test3.SetBuffer(Test2);

    Test3.SetLoop(true);
    Test3.Play();
    system("PAUSE");
    return 0;
 

Replace system("PAUSE"); with whatever pause preference you have. There's a gap in the loop. Try humming a constant note and you'll notice it.

44
Audio / How do I seamlessly loop recorded sounds?
« on: August 29, 2012, 09:16:43 pm »
I've built a class on sf::SoundBufferRecorder, and it automates the recording, buffering and sound creation process. I want to then be able to play the sounds that it records in a seamless loop. .SetLoop(true) does not give seamless looping. How would I go about doing this?

45
Graphics / Re: Displaying sub-images?
« on: August 23, 2012, 09:37:28 pm »
Okay, got it. 1.6 as 2.0 is still set as a 'future' release (I know I can get it now but I'll wait until it's all ready first). Confusion there.

Quote
Texture only seems to be able to load only one portion of the image from file
Where did you get that idea from? sf::Texture::loadFromFile() loads the whole and complete image into memory. I think there's a bit of confusion about the usage of sf::Image, sf::Texture and sf::Sprite. You should definately look that up. (setTextureRect is a member of sf::Sprite btw)

You could always create multiple instances of sf::Sprite that get their information from the same sf::Texture but use different TextureRects. You could as well change the Rect of a single sf::Sprite after drawing and then draw again with the new Rect, and so on. (I've never used any of the 2 methods, but both should work according to my understanding of it.)

Is that what you're talking about?

I think?

But it's not under Sprite either:
http://www.sfml-dev.org/documentation/1.6/classsf_1_1Sprite.php

"SetSubRect (const IntRect &SubRect)" Maybe?

I'm not daft about how to go about it. I'm daft as to what function does it. In Java it was something like 'SetView' for their own version of the images (change the view of the image made sense to me).

Pages: 1 2 [3] 4 5 ... 9
anything